#ifndef VERTEX_H
#define VERTEX_H

#include "D3dUtil.h"

void InitAllVertexDeclaration();
void DestroyAllVertexDeclaration();

struct VertexPos
{
	VertexPos():pos(0.0f, 0.0f, 0.0f){}
	VertexPos(float x, float y, float z): pos(x,y,z){}
	VertexPos(const D3DXVECTOR3& v): pos(v){}
	D3DXVECTOR3 pos;

	static IDirect3DVertexDeclaration9* decl;
};

struct VertexCol
{
	VertexCol():pos(0.0f, 0.0f, 0.0f), col(0x00000000){}
	VertexCol(float x, float y, float z, D3DCOLOR c)
		:pos(x,y,z), col(c){}
	VertexCol(const D3DXVECTOR3& v, D3DCOLOR c)
		:pos(v), col(c){}

	D3DXVECTOR3 pos;
	D3DCOLOR col;

	static IDirect3DVertexDeclaration9* decl;
};

struct VertexTexCol
{
	VertexTexCol():pos(0.0f, 0.0f, 0.0f)
				, col(0x00000000)
				, tex0(0.0f, 0.0f)
	{}

	VertexTexCol(float x, float y, float z
				, float u, float v
				, D3DCOLOR c)
		:pos(x,y,z)
		, col(c)
		, tex0(u, v)
	{}

	VertexTexCol(const D3DXVECTOR3& v
			, const D3DXVECTOR2& uv
			, D3DCOLOR c)
		:pos(v)
		, tex0(uv)
		, col(c)
	{}

	

	D3DXVECTOR3 pos;
	D3DXVECTOR2 tex0;
	D3DCOLOR col;

	static IDirect3DVertexDeclaration9* decl;
};

struct VertexTex
{
	VertexTex():pos(0.0f, 0.0f, 0.0f)
			  , tex0(0.0f, 0.0f)
	{}

	VertexTex(float x, float y, float z
			, float u, float v)
		: pos(x,y,z)
		, tex0(u, v)
	{}

	VertexTex(const D3DXVECTOR3& v
			, const D3DXVECTOR2& uv)
		: pos(v)
		, tex0(uv)
	{}

	D3DXVECTOR3 pos;
	D3DXVECTOR2 tex0;

	static IDirect3DVertexDeclaration9* decl;
};

struct GrassVertex
{
	GrassVertex()
		:pos(0.0f, 0.0f, 0.0f),
		tex0(0.0f, 0.0f),
		amplitude(0.0f){}
	GrassVertex(const D3DXVECTOR3& v, 
		const D3DXVECTOR2& uv, float amp)
		:pos(v), tex0(uv), amplitude(amp){}
	D3DXVECTOR3 pos;
	D3DXVECTOR3 quadPos;
	D3DXVECTOR2 tex0;
	float amplitude; // for wind oscillation.
	D3DCOLOR colorOffset;

	static IDirect3DVertexDeclaration9* decl;
};
#endif
